﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FunDraw
{
    public partial class DlgRenameLayer : Form
    {
        public string layername { get; set; }
        public DlgRenameLayer()
        {
            InitializeComponent();
        }

        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }

        private void btn_ok_Click(object sender, EventArgs e)
        {
            if(txt_layername.Text==string.Empty)
            {
                MessageBox.Show("新的图层名称不能为空!");
                txt_layername.Focus();
            }
            else
            {
                layername = txt_layername.Text.Trim();
                this.DialogResult = DialogResult.OK;
            }
        }

        private void txt_layername_KeyPress(object sender, KeyPressEventArgs e)
        {
            if(e.KeyChar==13)
            {
                btn_ok.Focus();
            }
        }
    }
}
